package horsechess.client.handle;

import horsechess.client.gui.GUIDice;
import java.util.Random;

/**
 * @author Administrator
 * @version 2.2
 * @created 17-Apr-2011 11:51:53 AM
 */
public class Dice {

    /**
     * The value of first dice
     */
    private int diceValue1=0;
    /**
     * The value of second dice
     */
    private int diceValue2=0;
    /**
     * The number of dice that user are playing
     */
    private int numberDices;

    public Dice() {
    }

    /////Getter && Setter
    public int getDiceValue1() {
        return diceValue1;
    }

    public void setDiceValue1(int diceValue1) {
        this.diceValue1 = diceValue1;
    }

    public int getDiceValue2() {
        return diceValue2;
    }

    public void setDiceValue2(int diceValue2) {
        this.diceValue2 = diceValue2;
    }

    public int getNumberDices() {
        return numberDices;
    }

    public void setNumberDices(int numberDices) {
        this.numberDices = numberDices;
    }

    /**
     * The player rolling the dice
     *
     * @param dice
     */
    public void rollDice(GUIDice dice) {
        numberDices=dice.getNumberOfDice();

        if(numberDices==1)
        {
            dice.loadImageDice1(diceValue1);
        }
        else
        {
            dice.loadImageDice1(diceValue1);
            dice.loadImageDice2(diceValue2);
        }
    }

    /**
     * The random value of dice
     *
     * @param rd
     */
    public int randomDiceValue(Random rd) {
        return rd.nextInt(6)+1;
    }

    public int getDiceValue(){
        return diceValue1+diceValue2;
    }
}
